package o;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.UserManager;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;

public final class eqh {
    private static eqh ˏ;
    private boolean ˊ;
    private UserManager ॱ;

    private eqh() {
        this.ˊ = dok.ˏॱ() == 0;
        this.ॱ = (UserManager) ContentManager.getInstant().getContext().getSystemService("user");
    }

    public static synchronized eqh ˎ() {
        eqh o_eqh;
        synchronized (eqh.class) {
            if (ˏ == null) {
                ˏ = new eqh();
            }
            o_eqh = ˏ;
        }
        return o_eqh;
    }

    @TargetApi(17)
    public boolean ˋ() {
        if (this.ॱ != null) {
            try {
                Object invoke = UserManager.class.getDeclaredMethod("supportsMultipleUsers", new Class[0]).invoke(this.ॱ, new Object[0]);
                if (invoke instanceof Boolean) {
                    return ((Boolean) invoke).booleanValue();
                }
            } catch (NoSuchMethodException e) {
                Logger.e("MultiUserSupport", "can not get supportsMultipleUsers");
            } catch (IllegalAccessException e2) {
                Logger.e("MultiUserSupport", "can not get supportsMultipleUsers");
            } catch (IllegalArgumentException e3) {
                Logger.e("MultiUserSupport", "can not get supportsMultipleUsers");
            } catch (InvocationTargetException e4) {
                Logger.e("MultiUserSupport", "can not get supportsMultipleUsers");
            }
        }
        return false;
    }

    public String ˋ(Context context, int i) {
        if (this.ॱ == null) {
            return "";
        }
        try {
            Object invoke = this.ॱ.getClass().getMethod("getUserInfo", new Class[]{Integer.TYPE}).invoke(this.ॱ, new Object[]{Integer.valueOf(i)});
            Field field = invoke.getClass().getField("name");
            if (field.getType().getName().equals(String.class.getName())) {
                return (String) field.get(invoke);
            }
        } catch (Exception e) {
            Logger.ˋ("MultiUserSupport", "getUserName Exception");
        }
        return "";
    }

    public boolean ˏ() {
        return this.ˊ;
    }

    public int ॱ() {
        int i = 1;
        if (this.ॱ != null) {
            try {
                i = this.ॱ.getUserCount();
            } catch (Exception e) {
                Logger.ˏ("MultiUserSupport", "can not get user count.Exception:" + e.toString());
            }
            Logger.ˏ("MultiUserSupport", "getUserCount = " + i);
        }
        return i;
    }
}
